package com.guli.mall.controller;
/*
 * @Author 罗
 * @date 2020/10/13 - 5:55 下午
 */

import com.guli.common.to.SpuEsTo;
import com.guli.common.utils.R;
import com.guli.mall.service.ProductSearchService;
import com.guli.mall.vo.SearchParamsVo;
import com.guli.mall.vo.SearchResultVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
public class SearchController {

    @Resource
    ProductSearchService productSearchService;

    @PostMapping("/searchProduct")
    public R search(@RequestBody SearchParamsVo searchParams) throws IOException {

        SearchResultVo searchResultVo = productSearchService.search(searchParams);

        return R.ok().put("page",searchResultVo);
    }
}
